const webpack = require('webpack');
const path = require('path');

module.exports = {
  entry: {
    app: ['./src/index.js']
  },
  output: {
    path: __dirname + '/build',
    filename: 'bundle.js'
  },
  debug: true,
  devtool: 'eval',
  plugins: [
    new webpack.ProvidePlugin({
      riot: 'riot',
      videojs: 'video.js',
      $: 'jquery',
      cookies: 'js-cookie',
      route: 'riot-route/tag'
    }),
    new webpack.optimize.OccurenceOrderPlugin()
  ],
  module: {
    preLoaders: [{
      test: /\.tag$/,
      exclude: /node_modules/,
      loader: 'riot-tag-loader',
      query: {
        type: 'es6', // transpile the riot tags using babel
        hot: true,
        debug: true
      }
    }],
    loaders: [{
      test: /\.(swf|woff|woff2|eot|ttf|svg|otf)([\?]?.*)$/,
      loader: 'file-loader'
    }, {
      test: /\.(png|jpg|jpeg|gif)$/,
      loader: 'url-loader?limit=1&name=images/[name].[ext]'
        //loader: 'url-loader?limit=8192&name=images/[name].[ext]'
    }, {
      test: /\.js$/,
      exclude: /node_modules/,
      include: /src/,
      loader: 'babel-loader'
    }, {
      test: /\.css$/,
      loader: 'style-loader!css-loader'
    }]
  },
  devServer: {
    contentBase: __dirname + '/build',
    host: '0.0.0.0',
    disableHostCheck: true,
    port: 4000,
    compress: false,
    hot: true,
    inline: true
  }
};